////////////////////////////////////////////////
// -- DepthHUD Lite                           //
// by Hurricaaane (Ha3)                       //
//                                            //
// http://www.youtube.com/user/Hurricaaane    //
//--------------------------------------------//
// Base label                                 //
////////////////////////////////////////////////

local PANEL = {}

AccessorFunc( PANEL, "m_fRate", "Rate" )
//AccessorFunc( PANEL, "m_fText", "Text" )

function PANEL:Init()
	self.e_vIndicator = vgui.Create( "HIndicator", self )
	self.e_vMainLabel = vgui.Create( "HLabel", self )
	self.e_vSubLabel  = vgui.Create( "HLabel", self )
	self.p_IsString = false
	self.p_FontSize = 1
	
	self:SetMainAlign( 8 )
	self:SetMainSize( 3 )
	self:SetMainType( "number" )
	self:SetMainColor( color_white )
	self:SetMainVisible( true )
	self:UpdateMainFont( )

	self:SetSubAlign( 2 )
	self:SetSubSize( 1 )
	self:SetSubType( "pixel" )
	self:SetSubColor( color_white )
	self:SetSubVisible( true )
	self:UpdateSubFont( )
	
end

function PANEL:GetIndicator()
	return self.e_vIndicator
	
end

function PANEL:GetMainLabel()
	return self.e_vMainLabel
	
end

function PANEL:GetSubLabel()
	return self.e_vSubLabel
	
end

//////

function PANEL:SetMainAlign( iContentAlignment )
	self.e_vMainLabel:SetTextAlign( iContentAlignment )
	
end

function PANEL:SetMainColor( cColor )
	self.e_vMainLabel:SetColor( cColor )
	
end

function PANEL:SetMainText( sText )
	self.e_vMainLabel:SetText( sText )
	
end

function PANEL:SetMainType( bIsString )
	self.e_vMainLabel:SetFontType( bIsString )
	
end

function PANEL:SetMainSize( iSize ) // 1 2 3 4
	self.e_vMainLabel:SetFontSize( iSize )
	
end

function PANEL:UpdateMainFont( )
	self.e_vMainLabel:UpdateFont( )
	
end

function PANEL:SetMainVisible( bVisible )
	self.e_vMainLabel_visSetting = bVisible
	self.e_vMainLabel:SetVisible( bVisible )
	
end

function PANEL:SetMainOverrideVisibility( bOverride, bVisible )
	if bOverride then
		self.e_vMainLabel:SetVisible( bVisible )
		
	else
		self.e_vMainLabel:SetVisible( self.e_vMainLabel_visSetting )
		
	end
	
	
end

//////

function PANEL:SetSubAlign( iContentAlignment )
	self.e_vSubLabel:SetTextAlign( iContentAlignment )
	
end

function PANEL:SetSubColor( cColor )
	self.e_vSubLabel:SetColor( cColor )
	
end

function PANEL:SetSubText( sText )
	self.e_vSubLabel:SetText( sText )
	
end

function PANEL:SetSubType( bIsString )
	self.e_vSubLabel:SetFontType( bIsString )
	
end

function PANEL:SetSubSize( iSize ) // 1 2 3 4
	self.e_vSubLabel:SetFontSize( iSize )
	
end

function PANEL:UpdateSubFont( )
	self.e_vSubLabel:UpdateFont( )
	
end


function PANEL:SetSubVisible( bVisible )
	self.e_vSubLabel_visSetting = bVisible
	self.e_vSubLabel:SetVisible( bVisible )
	
end

function PANEL:SetSubOverrideVisibility( bOverride, bVisible )
	if bOverride then
		self.e_vSubLabel:SetVisible( bVisible )
		
	else
		self.e_vSubLabel:SetVisible( self.e_vSubLabel_visSetting )
		
	end
	
	
end

////

function PANEL:SetRate( fRate )
	self.e_vIndicator:SetRate( fRate )
	
end

Derma_Hook( PANEL, "PerformLayout", "Layout", "HIndicatorLabel" )
derma.DefineControl( "HIndicatorLabel", "", PANEL, "HPanel" )
